package de.voegel.model.entity;

public class CompareBird implements Comparable<CompareBird> {

	private final String deutscherName;
	private final String latName;

	public CompareBird(String deutscherName, String latName) {
		super();
		this.deutscherName = deutscherName;

		String[] lNames = latName.split(" ");
		this.latName = lNames[0] + " " + lNames[1];
	}

	public String getDeutscherName() {
		return deutscherName;
	}

	public String getLatName() {
		return latName;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((latName == null) ? 0 : latName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CompareBird other = (CompareBird) obj;
		if (latName == null) {
			if (other.latName != null)
				return false;
		} else if (!latName.equals(other.latName))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "[deutscherName=" + deutscherName + ", latName=" + latName + "]";
	}

	@Override
	public int compareTo(CompareBird o) {
		if (latName == null) {
			return -1;
		}
		return latName.compareTo(o.getLatName());
	}

}
